const attr = {
  color: ["w", "r", "b"],
  size: ["l", "m", "s"],
  type: ["o", "s", "t"],
};

const obj2arr = (obj) => {
  const keys = Object.keys(obj)
  const res = keys.reduce((arr, v) => {
    const tempArr = []
    for(let i = 0, n = obj[v].length; i < n; i++) {
      tempArr.push(`${v}:${obj[v][i]}`)
    }
    arr.push(tempArr)
    return arr
  }, [])
  const arr = []
  for(let i = 0, n = res.length; i < n; i++) {
    const tempArr = []
    for (let j = 0, len = res[i].length; j < len; j++) {
      tempArr.push(res[j][i])
    }
    arr.push(tempArr);
  }
  return arr
}

const obj2arr2 = (obj) => {
  const res = []
  const keys = Object.keys(obj);
  for (let i = 0, n = keys.length; i < n; i++) {
    const temp = keys.map(v => {
      let str = `${v}: ${obj[v][i]}` 
      return str
    })
    res.push(temp)
  }
  return res
}
